package com.kexio.enterprise.integration.event.result;

import com.kexio.enterprise.integration.event.enums.EventStatus;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 事件发布结果
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class EventPublishResult {
    private boolean success;
    private String eventId;
    private EventStatus status;
    private int listenerCount;
    private int successCount;
    private int failureCount;
    private String errorMessage;
    private LocalDateTime publishTime;
    private long processingTime;
    private Map<String, Object> metadata;

    public EventPublishResult() {
        this.publishTime = LocalDateTime.now();
    }

    public EventPublishResult(boolean success, String eventId) {
        this();
        this.success = success;
        this.eventId = eventId;
        this.status = success ? EventStatus.PROCESSED : EventStatus.FAILED;
    }

    // Getters and Setters
    public boolean isSuccess() { return success; }
    public void setSuccess(boolean success) { this.success = success; }
    
    public String getEventId() { return eventId; }
    public void setEventId(String eventId) { this.eventId = eventId; }
    
    public EventStatus getStatus() { return status; }
    public void setStatus(EventStatus status) { this.status = status; }
    
    public int getListenerCount() { return listenerCount; }
    public void setListenerCount(int listenerCount) { this.listenerCount = listenerCount; }
    
    public int getSuccessCount() { return successCount; }
    public void setSuccessCount(int successCount) { this.successCount = successCount; }
    
    public int getFailureCount() { return failureCount; }
    public void setFailureCount(int failureCount) { this.failureCount = failureCount; }
    
    public String getErrorMessage() { return errorMessage; }
    public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }
    
    public LocalDateTime getPublishTime() { return publishTime; }
    public void setPublishTime(LocalDateTime publishTime) { this.publishTime = publishTime; }
    
    public long getProcessingTime() { return processingTime; }
    public void setProcessingTime(long processingTime) { this.processingTime = processingTime; }
    
    public Map<String, Object> getMetadata() { return metadata; }
    public void setMetadata(Map<String, Object> metadata) { this.metadata = metadata; }
}
